package com.demo.zookeeper;

import java.io.IOException;

import org.apache.zookeeper.CreateMode;
import org.apache.zookeeper.KeeperException;
import org.apache.zookeeper.ZooDefs;
import org.apache.zookeeper.ZooKeeper;

public class ZookeeperCreate {
	
	private static ZooKeeper zk;
	
	public static void createNode(String path, byte[] data) throws KeeperException, InterruptedException {
		zk.create(path, data, ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);
	}
	
	public static void main(String[] args) throws IOException, InterruptedException, KeeperException {
		zk = ZookeeperConnection.connect();
		String path = "/dataNode";
		byte[] data = "data".getBytes();
		createNode(path, data);
		ZookeeperConnection.close();
	}
}
